Total Complexity | 2 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import { |
||
16 | |||
17 | @Controller('daily_rates') |
||
18 | @ApiUseTags('Billing') |
||
19 | @ApiBearerAuth() |
||
20 | @UseGuards(AuthGuard('bearer')) |
||
21 | export class UpdateDailyRateAction { |
||
22 | constructor( |
||
23 | @Inject('ICommandBus') |
||
24 | private readonly commandBus: ICommandBus |
||
25 | ) {} |
||
26 | |||
27 | @Put(':id') |
||
28 | @ApiOperation({title: 'Update daily rate'}) |
||
29 | public async index(@Param() idDto: IdDTO, @Body() dto: DailyRateDTO) { |
||
30 | try { |
||
31 | const {userId, customerId, taskId, amount} = dto; |
||
32 | |||
33 | const id = await this.commandBus.execute( |
||
34 | new UpdateDailyRateCommand(idDto.id, amount, userId, customerId, taskId) |
||
35 | ); |
||
36 | |||
37 | return {id}; |
||
38 | } catch (e) { |
||
39 | throw new BadRequestException(e.message); |
||
40 | } |
||
43 |